﻿using System;
using System.ComponentModel;
using System.Globalization;

namespace AMatysiak.Converters
{
    public class PolishBooleanConverter : BooleanConverter
    {
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType)
        {
            try
            {
                return (bool)value ? "Tak" : "Nie";
            }
            catch
            {
                return "Nie";
            }
        }

        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            return (string)value == "Tak";
        }
    }
}
